<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:bi="http://java.sun.com/jsf/composite/cashTransaction">
    <ui:define name="content">
        <h:panelGroup >
            <h:form  >
                <p:panel rendered="#{!cashInController.printPreview}">
                    <f:facet name="header">
                        <h:outputLabel value="CASH IN"/>

                    </f:facet>
                    <h:panelGrid columns="3">
                        <p:panel>
                            <f:facet name="header">
                                <h:outputLabel value="NOTE"/>
                            </f:facet>
                            <h:panelGrid columns="6" >
                                <h:outputLabel value="1/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty1}" 
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="2/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty2}" 
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="5/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty5}" 
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="10/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty10}"
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="20/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty20}" 
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="50/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty50}"
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="100/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty100}"
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="200/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty200}" 
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="500/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty500}"
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="1000/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty1000}" 
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="2000/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty2000}"
                                             disabled="#{cashInController.referenceBill ne null}"/>
                                <h:outputLabel value="5000/="/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.qty5000}" 
                                             disabled="#{cashInController.referenceBill ne null}"/>
                            </h:panelGrid>
                        </p:panel>
                        <p:panel>
                            <f:facet name="header">
                                <h:outputLabel value="Summary"/>
                            </f:facet>
                            <h:panelGrid columns="2">                                
                                <p:commandButton ajax="false" value="Cal Cash Value" action="#{cashInController.calTotal()}" onclick="onSubmitButton();"/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.cashValue}"
                                             disabled="#{cashInController.referenceBill ne null}">
                                    <f:convertNumber pattern="#000.00"/>
                                </p:inputText>
                                <h:outputLabel value="Credit Card Tot" />
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.creditCardValue}" 
                                             disabled="#{cashInController.referenceBill ne null}">
                                    <f:convertNumber pattern="#000.00"/>
                                </p:inputText>
                                <h:outputLabel value="Slip Total"/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.slipValue}" 
                                             disabled="#{cashInController.referenceBill ne null}">
                                    <f:convertNumber pattern="#000.00"/>
                                </p:inputText>
                                <h:outputLabel value="Cheque Total"/>
                                <p:inputText autocomplete="off" value="#{cashInController.bill.cashTransaction.chequeValue}" 
                                             disabled="#{cashInController.referenceBill ne null}">
                                    <f:convertNumber pattern="#000.00"/>
                                </p:inputText>
                                <h:outputLabel value="Comment  : "/>
                                <p:inputText></p:inputText>
                            </h:panelGrid>
                        </p:panel>
                        <h:outputLabel/>
                        <p:panel>
                            <f:facet name="header">
                                <h:outputLabel value="FROM DRAWER DETAIL"/>
                            </f:facet>
                            <h:panelGrid columns="2">      
                                <h:outputLabel value="Cashier : "/>
                                <h:outputLabel value="#{cashInController.referenceBill.fromWebUser.webUserPerson.nameWithTitle}"
                                               style="float:  right;"/>
                                <h:outputLabel value="Cash :" />
                                <h:outputLabel value="#{cashInController.referenceBill.fromWebUser.drawer.runningBallance}"
                                               style="float:  right;">
                                    <f:convertNumber pattern="#000.00"/>
                                </h:outputLabel>
                                <h:outputLabel value="CreditCard : "/>
                                <h:outputLabel value="#{cashInController.referenceBill.fromWebUser.drawer.creditCardBallance}"
                                               style="float:  right;">
                                    <f:convertNumber pattern="#000.00"/>
                                </h:outputLabel>
                                <h:outputLabel value="Cheque  : "/>
                                <h:outputLabel value="#{cashInController.referenceBill.fromWebUser.drawer.chequeBallance}"
                                               style="float:  right;">
                                    <f:convertNumber pattern="#000.00"/>
                                </h:outputLabel>
                                <h:outputLabel value="Slip  : "/>
                                <h:outputLabel value="#{cashInController.referenceBill.fromWebUser.drawer.slipBallance}"
                                               style="float:  right;">
                                    <f:convertNumber pattern="#000.00"/>
                                </h:outputLabel>
                                
                                
                                
                            </h:panelGrid>
                        </p:panel>
                        <p:panel>
                            <f:facet name="header">
                                <h:outputLabel value="CURRENT DRAWER DETAIL"/>
                            </f:facet>
                            <h:panelGrid columns="2">      
                                <h:outputLabel value="Cashier"/>
                                <h:outputLabel value="#{sessionController.loggedUser.webUserPerson.nameWithTitle}"
                                               style="float:  right;"/>
                                <h:outputLabel value="Cash :" />
                                <h:outputLabel value="#{sessionController.loggedUser.drawer.runningBallance}"
                                               style="float:  right;">
                                    <f:convertNumber pattern="#000.00"/>
                                </h:outputLabel>
                                <h:outputLabel value="CreditCard : "/>
                                <h:outputLabel value="#{sessionController.loggedUser.drawer.creditCardBallance}"
                                               style="float:  right;">
                                    <f:convertNumber pattern="#000.00"/>
                                </h:outputLabel>
                                <h:outputLabel value="Cheque  : "/>
                                <h:outputLabel value="#{sessionController.loggedUser.drawer.chequeBallance}"
                                               style="float:  right;">
                                    <f:convertNumber pattern="#000.00"/>
                                </h:outputLabel>
                                <h:outputLabel value="Slip  : "/>
                                <h:outputLabel value="#{sessionController.loggedUser.drawer.slipBallance}"
                                               style="float:  right;">
                                    <f:convertNumber pattern="#000.00"/>
                                </h:outputLabel>
                            </h:panelGrid>

                        </p:panel>

                        <p:panel>
                            <p:commandButton ajax="false" value="Settle" action="#{cashInController.settle()}" onclick="onSubmitButton();"/>
                            <p:commandButton ajax="false" value="Clear" action="#{cashInController.makeNull()}" onclick="onSubmitButton();"/>
                        </p:panel>
                    </h:panelGrid>
                </p:panel>

                <p:panel rendered="#{cashInController.printPreview}">
                    <p:commandButton ajax="false" value="New Bill"
                                    actionListener="#{cashInController.makeNull()}" onclick="onSubmitButton();"/>

                    <bi:cashIn  bill="#{cashInController.bill}"/>
                </p:panel>
            </h:form>
        </h:panelGroup>

    </ui:define>

</ui:composition>
